#include <iostream>
using namespace std;
const int N = 100010;

int q[N];
int n,k;

int quick_choose(int q[],int l, int r, int k){

    if(l >= r) return q[l];

    int x = q[l + r >> 1], i = l - 1, j = r + 1;

    while(i < j){
        do i++; while (q[i] < x);
        do j--; while (q[j] > x);
        if(i < j){
            int t = q[i];
            q[i] = q[j];
            q[j] = t;        
        }
    }
    
    int s1 = j - l + 1;

    if(k > s1) return quick_choose(q, j + 1, r, k - s1);

    else return quick_choose(q, l, j, k);
}

int main(){

    scanf("%d %d",&n,&k);

    for(int i = 0; i < n; i++) scanf("%d",&q[i]);

    printf("%d",quick_choose(q, 0, n - 1, k));

    return 0;
}